//
//  StatusCell.swift
//  WeiBo_test
//
//  Created by 张leslie45 on 16/1/20.
//  Copyright © 2016年 张leslie45. All rights reserved.
//

import UIKit
import SnapKit

class StatusCell: UITableViewCell {
    
    var status:Status?{
    
        didSet {
          //绑定数据
          //设置原创微博的数据模型
           statusOriginalView.status = status
        }
    }

    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
       setupUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

   //设置UI
    private func setupUI(){
        backgroundColor = UIColor.yellowColor()
        contentView.addSubview(statusOriginalView)
        contentView.addSubview(statusCellBottomView)
        
        //设置约束
        statusOriginalView.snp_makeConstraints { (make) -> Void in
            make.top.left.right.equalTo(contentView)
            //设置 测试 高度
            //make.height.equalTo(80)
        }
        
        statusCellBottomView.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(statusOriginalView.snp_bottom)
            make.left.right.equalTo(contentView)
            make.height.equalTo(35)
        }
        
        
        //给contenView设置约束条件
        contentView.snp_makeConstraints { (make) -> Void in
            make.left.right.top.equalTo(self)
       //自动计算行高的最关键的一条约束
            make.bottom.equalTo(statusCellBottomView.snp_bottom)
        }
    }

    //如果从xib/storyBoard中加载,会调用到这个方法
    override func awakeFromNib() {
        super.awakeFromNib()
    }

    override func setSelected(selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
        
    }
    
//原创微博
    private lazy var statusOriginalView:StatusOriginalView = StatusOriginalView()
    private lazy var statusCellBottomView:StatusCellBottomView = StatusCellBottomView()
 
    }
